<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.console.servlets.user.TjUser"%>
<%@page import="com.blockchain.console.servlets.user.FinanceEdit"%>
<%@page import="com.blockchain.console.servlets.user.ViewUser"%>
<%@page import="com.sun.org.apache.bcel.internal.generic.ISUB"%>
<%@page import="com.blockchain.console.servlets.user.UserLock"%>
<%@page import="com.blockchain.console.servlets.user.UpdateUser"%>
<%@page import="com.blockchain.common.enums.IsPass"%>
<%@page import="com.blockchain.console.servlets.user.UserList"%>
<%@page import="com.blockchain.console.service.user.entity.User"%>
<%@page import="com.blockchain.console.service.user.UserManage"%>
<html>
<head>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
</head>
<%
CURRENT_CATEGORY="HHGL";
CURRENT_SUB_CATEGORY="YHLB";
PagingResult<User> users = (PagingResult<User>)request.getAttribute("users");
User[] userArray = users.getItems();
IsPass superAdmin = (IsPass)request.getAttribute("superAdmin");
%>
<body>
	<%@include file="/WEB-INF/include/header.jsp"%>
	<div class="w_main">
		<div class="main clearfix">
			<div class="wrap">
			<form action="<%=controller.getURI(request, UserList.class) %>" method="post">
				<div class="r_main">
					<div class="home_main">
						<div class="box box1 mb15">
							<div class="atil">
                    		<h3>会员账号</h3>
                  			</div>
                  		<div class="con">
						<div class="clear"></div>
						<ul class="yhxq_li">
							<li>总计：<span class="blue"><%=users.getItemCount()%></span>人</li>
						</ul>
						<div class="clear"></div>
						</div>
						</div>
						<div class="box box1 mb15">
							<div class="clear"></div>
							<div class="con">
							<div class="admin_input admin_pb">
							  	<p>ID：<input type="text" name="userid" value="<%StringHelper.filterHTML(out, request.getParameter("userid"));%>" class="yhgl_input mr5" /></p>
                                <p>姓名：<input type="text" name="name" value="<%StringHelper.filterHTML(out, request.getParameter("name"));%>" class="yhgl_input mr5" /></p>
                                <p>证件号：<input type="text" name="zjh" value="<%StringHelper.filterHTML(out, request.getParameter("zjh"));%>" class="yhgl_input mr5" /></p>
                                <p>手机：<input type="text" name="sjh" value="<%StringHelper.filterHTML(out, request.getParameter("sjh"));%>" class="yhgl_input" /></p>
                       	    	<p>注册时间：<input type="text" name="start" readonly="readonly" id="datepicker1" class="yhgl_input date" />
                                <span class="pr10">至</span><input readonly="readonly" type="text" name="end" id="datepicker2" class="yhgl_input date" /></p>
                                <p>是否锁定：
                                	<select name="userState" class="yhgl_sel">
                                  	<option value="">请选择</option>
                                  	<%
                                  		for (IsPass userState : IsPass.values()) {
                                  	%>
									<option value="<%=userState.name()%>" <%if (userState.name().equals(request.getParameter("userState"))) {%> selected="selected" <%}%>><%=userState.getName()%></option>
									<%
										}
									%>                                
                                  </select>
                                </p>
                                <p>高级认证：
                                	<select name="sftgjrz" class="yhgl_sel">
                                	    <option value="">请选择</option>
	                                  	<%
	                                  		for (IsPass is : IsPass.values()) {
	                                  	%>
											<option value="<%=is.name()%>" <%if (is.name().equals(request.getParameter("sftgjrz"))) {%> selected="selected" <%}%>><%=is.getName()%></option>
										<%
											}
										%>
                                  </select>
                                  </p>		
										
						 		<div class="mt10">
						 			<input name="" type="submit" class="btn2 mr10" value="搜索" />
						 			<div class="clear"></div>
								</div>
						    </div>
						</div>
						</div>
						<div>
							<table width="100%" border="0" cellspacing="0" cellpadding="3" class="yhgl_table tc">
						<tr class="hsbg">
                          <td>序号</td>
                          <td>用户ID</td>
                          <td>姓名</td>
                          <td>手机</td>
                          <td>证件类型</td>
                          <td>证件号</td>
                          <td>注册时间</td>
                          <td>推荐的人</td>
                          <td>是否锁定</td>
                          <td>高级认证</td>
                          <td>操作</td>
                        </tr>
						<%
                        if (userArray != null) {for (int i =0;i<userArray.length;i++){User user=userArray[i];if (user == null) {continue;}
                        %>
                        <tr class="dhsbg">
                          <td><%=i+1%></td>
                          <td><%=user.userId%></td>
                          <td><%StringHelper.filterHTML(out, user.name);%></td>
                          <td><%StringHelper.filterHTML(out, user.iphone);%></td>
                          <td><%if(user.certificateType!=null){%><%=user.certificateType.getName()%><%}%></td>
                          <td><%StringHelper.filterHTML(out, user.zjhm);%></td>
                          <td><%=TimestampParser.format(user.registrationTime)%></td>
                          <td><span class="blue"><a href="<%=controller.getURI(request,TjUser.class)%>?userid=<%=user.userId%>" class="mr10">查看</a></span></td>
                          <td><%=user.userState.getName()%></td>
                          <td><%if(user.sftggjrz==IsPass.S){%>是<%}else{%>否<%}%></td>
                          <td>
                          <%if (blockchainSession.isAccessableResource(ViewUser.class)) {%>
                          	<span class="blue"><a href="<%=controller.getURI(request,ViewUser.class)%>?userid=<%=user.userId%>" class="mr10">查看</a></span>
                          <%}%>
                          <%if (blockchainSession.isAccessableResource(UpdateUser.class)) {%>
                          	<span class="blue"><a href="<%=controller.getURI(request,UpdateUser.class)%>?userid=<%=user.userId%>" class="mr10">编辑</a></span>
                          <%}%>
                          <%if (blockchainSession.isAccessableResource(UserLock.class)){if(user.userState==IsPass.F){%>
		                     <span class="blue"><a href="javascript:void(0)" onclick="load('<%=controller.getURI(request, UserLock.class)%>?userid=<%=user.userId%>&sfsd=<%=IsPass.S%>')" class="mr10">锁定</a></span>
		                  <%}else{%>
		                   	<span class="blue"><a href="javascript:void(0)" onclick="load('<%=controller.getURI(request, UserLock.class)%>?userid=<%=user.userId%>&sfsd=<%=IsPass.F%>')" class="mr10">解锁</a></span>
		                  <%}}%>
		                  
                          <%if (superAdmin.getName().equals(IsPass.S.getName())){%>
		                     <span class="blue"><a href="<%=controller.getURI(request, FinanceEdit.class)%>?userid=<%=user.userId%>" class="mr10">资产管理</a></span>
		                  <%}%>
                          </td>
						</tr>
								<%}}%>
							</table>
						</div>
							<%AbstractConsoleServlet.rendPagingResult(out, users); %>
						<div class="box2 clearfix"></div>
					</div>
				</div>
				</form>
			</div>
			<%@include file="/WEB-INF/include/left.jsp" %>
		</div>
	</div>
	<%@include file="/WEB-INF/include/footer.jsp"%>
	<%@include file="/WEB-INF/include/script.jsp"%>
	<%@include file="/WEB-INF/include/datepicker.jsp"%>
	<script type="text/javascript">
		$(function() {
			$("#datepicker1").datepicker({inline: true});
		    $('#datepicker1').datepicker('option', {dateFormat:'yy-mm-dd'});
		    $("#datepicker2").datepicker({inline: true});
		    $('#datepicker2').datepicker('option', {dateFormat:'yy-mm-dd'});
		    $("#datepicker1").datepicker("setDate", "<%StringHelper.filterHTML(out, request.getParameter("start"));%>");
		    $("#datepicker2").datepicker("setDate", "<%StringHelper.filterHTML(out, request.getParameter("end"));%>");
		});
		function load(url)
		{
			if (!window.confirm("你确定锁定用户吗？")) {
				return;
			}
			location.href=url;
		}
		</script>
</body>
</html>